﻿@using Kugar.Core.ExtMethod
@using Kugar.UI.Web.AdminLTE
@using Kugar.UI.Web.AdminLTE.Enums
@using Kugar.UI.Web.AdminLTE.Helpers
@using Kugar.UI.Web.AdminLTE.Models
@using Kugar.UI.Web.AdminLTE.PageControls
@using Kugar.UI.Web.AdminLTE.PageControls.Helpers.ButtonExtMethod
@using Kugar.UI.Web.AdminLTE.PageControls.PageForms
@model Kugar.UI.Web.AdminLTE.Models.Model_AdminUserAuthorityDetail

@inject AdminLTEUI WebUI

@{
    Layout = AdminLTEUI.LayoutPath.DefaultLayoutPath;
}

@*@using (WebUI.Control.ModalWindow().Title("管理员详情").ContentHeight(300).ID("divAdminDetail")
   .AddRightButton(btn => btn.Color(ColorPaletteEnum.primary).Text("保存").Type(ButtonTypeEnum.submit))
   .Render())*@

    @using (var frm = WebUI.Control.Form().Post()
        .UpdateElementID("divAdminDetail")
        
        .Render())
    {
        using (frm.AddCustomContainer().LabelWidth(0).Render())
        {
            foreach (var group in Model.Groups)
            {
                ViewContext.Writer.WriteLine($"<div class=\"webui_treeview col-sm-4\">");

                ViewContext.Writer.WriteLine($"<ul class=\"treeview_treeul\">");

                ViewContext.Writer.WriteLine($"<li class=\"menu_item menu_1\"  ><a>{group.GroupTitle}</a>");

                if (group.Items.HasData())
                {
                
                    ViewContext.Writer.WriteLine("<ul class=\"\">");

                    foreach (var item in group.Items)
                    {
                        ViewContext.Writer.WriteLine($"<li class=\"menu_item menu_2\" data-value=\"{item.AuthorityID}\" data-id=\"{item.AuthorityID}\" >");
                        ViewContext.Writer.WriteLine($"<a title=\"{item.Description}\">{item.Title}</a>");
                        ViewContext.Writer.WriteLine("</li>");
                    }

                    ViewContext.Writer.WriteLine("</ul>");
                }

                ViewContext.Writer.WriteLine("</li>");

                ViewContext.Writer.WriteLine("</ul>");

                ViewContext.Writer.WriteLine("</div>");
            }
        }
        
        @(frm.AddButtonList()
              .AddButton(x=>x.Text("save").DisabledAfterClick().Type(ButtonTypeEnum.submit).Color(ColorPaletteEnum.success))
              .AddButton(x=> x.Text("cancel").Type(ButtonTypeEnum.button).Color(ColorPaletteEnum.@default))
              .Render()
              )
    }
